* This script imports the estimation sample and runs pooled OLS regressions
* The regression output is saved as tex booktabs table 
* Author: Enno Schröder

* Set working directory
cd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

import delimited "..\dataprocessed\regression_data.csv", clear

rename gdppercapthousandpppadjustedusd income
label var income ""

rename tbeet tbeet
label var tbeet ""

* Drop ROW regions
drop if inlist(region, "WA", "WE", "WM", "WL", "WF")

eststo clear

* OLS 2015
eststo: reg tbeet income if year==2015, vce(robust)
eststo: reg tbeet income if year==2015 & pop>10, vce(robust)

* Pooled OLS
eststo: reg tbeet income ib2015.year, vce(cluster region)
eststo: reg tbeet income ib2015.year if pop>10, vce(cluster region)

esttab *, stats(N r2, fmt(0 3) label(N Rsq)) se label 

esttab * using "..\tabs\tab-regressions", ///
	stats(N r2, fmt(0 3) label(N "R squared")) se label booktabs nofloat nonotes replace ///
	indicate("Year effects = *.year") ///
	mtitle("2015, all" "2015, pop>10m" "Pooled, all" "Pooled, pop>10m") 

exit
